package fr.generali.accueilclient.gwt.client.ui.components.table.columns;

import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.cell.client.ImageResourceCell;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.Column;

/**
 * Colonne permettant d'ajouter dse cellules affichant des images.<br>
 *
 * @param <T>
 */
public abstract class ImageColumn<T> extends Column<T, ImageResource> {
	
	public ImageColumn() {
		super(new ImageResourceCell());
	}
	
	public ImageColumn(ImageResource imageResource) {
		super(new ImageResourceCell());
	}

	@Override
	public void render(Context context, T value, SafeHtmlBuilder sb) {
		if (value != null) {
			sb.appendHtmlConstant("<div style=\"text-align:center;\">");
			super.render(context, value, sb);
			sb.appendHtmlConstant("</div>");
		}
	}

	
}
